package com.ngmaster.apiserver.common;

import com.ngmaster.apiserver.util.ErrorNo;
import com.ngmaster.apiserver.util.StateNo;


/**
 * 基础结构体
 *
 */
public class BaseBody {
	/**
	 * 状态
	 */
	protected StateNo state = StateNo.Success;
	
	/**
	 * 错误码
	 */
	protected ErrorNo error = ErrorNo.Default;

	public StateNo getState() {
		return state;
	}

	public void setState(StateNo state) {
		this.state = state;
	}

	public ErrorNo getError() {
		return error;
	}

	public void setError(ErrorNo error) {
		this.error = error;
	}

	/**
	 * 获取错误码
	 * @param errorNo
	 * @return
	 */
	public static BaseBody getError(ErrorNo errorNo) {
		BaseBody body = new BaseBody();
		body.setError(errorNo);
		
		return body;
	}
}
